﻿<!-- "script/apps/Aries/Creator/Game/GUI/OpenAssetFileDialog.html" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
<pe:mcml>
<script refresh="false" type="text/npl" src="OpenAssetFileDialog.lua"><![CDATA[
OpenAssetFileDialog = commonlib.gettable("MyCompany.Aries.Game.GUI.OpenAssetFileDialog");
OpenAssetFileDialog.OnInit()
function OnClose()
    Page:CloseWindow();
end

function OnSelectFile(treenode)
    local filename = treenode.mcmlNode:GetPreValue("this").filename;
    if(filename) then
        OpenAssetFileDialog.SetText(filename);
    end
end

function OnSelectAnim(treenode)
    local id = treenode.mcmlNode:GetPreValue("this").id;
    if(id) then
        OpenAssetFileDialog.OnSelectAnimId(id)
    end
end
]]></script>
<aries:window mode="thin" title='<%=L"选择一个模型"%>' style="width:680px;" uiname_onclose="OpenAssetFileDialog.OnClose" onclose="OnClose">
    <div style="margin-left:0px;margin-top:5px;">
        <pe:repeat DataSource="<%=OpenAssetFileDialog.GetCategoryButtons()%>">
            <pe:repeatitem style="float:left;">
                <pe:if condition='<%=OpenAssetFileDialog.category_index == Eval("index") %>'>
                    <input type="button" value='<%=Eval("text")%>' uiname='<%="OpenAssetFileDialog.category_"..Eval("name")%>' name='<%=Eval("index")%>' style="margin-top:5px;margin-right:5px;color:#ffffff;font-size:12px;min-width:43px;height:22px;background:url(Texture/Aries/Creator/Theme/GameCommonIcon_32bits.png#208 89 21 21:8 8 8 8)" />
                </pe:if>
                <pe:if condition='<%=OpenAssetFileDialog.category_index ~= Eval("index") %>'>
                    <input type="button" value='<%=Eval("text")%>' uiname='<%="OpenAssetFileDialog.category_"..Eval("name")%>' name='<%=Eval("index")%>' onclick="OpenAssetFileDialog.OnChangeCategory" style="margin-top:5px;margin-right:5px;color:#ffffff;font-size:12px;min-width:43px;height:22px;background:url(Texture/Aries/Creator/Theme/GameCommonIcon_32bits.png#179 89 21 21:8 8 8 8)" />
                </pe:if>
            </pe:repeatitem>
        </pe:repeat>
    </div>
    <div style="margin-top:5px;" class="default">
        <div style="float:left;width:200px;padding-left:5px;">
            <div style="width:185px;height:185px;margin-bottom:5px;background-color:#00000080">
                <pe:canvas3d name="AssetPreview" DefaultRotY="-1.57" DefaultCameraObjectDist="5" autoRotateSpeed="0.12" miniscenegraphname="AssetPreview" RenderTargetSize="256" style="width:185px;height:185px;" />
                <div style="position:relative;margin-top:-180px;margin-left:5px;height:25px;width:180px;color:#808080;font-size:12px">
                    <input uiname="OpenAssetFileDialog.btnTakeShapshot" name="btnTakeShapshot" tooltip='<%=L"生成缩略图"%>' type="button" style="margin-right:5px;margin-top:2px;width:16px;height:16px;background:url(Texture/3DMapSystem/common/page_white_camera.png)" onclick="OpenAssetFileDialog.OnTakeSnapShot"/>
                    <%=L"面数:"%><pe:label name="PolyCount" style="margin-left:5px;margin-top:1px"></pe:label>
                </div>
            </div>
            <pe:treeview ShowIcon="false" name="tvwAnimIds" VerticalScrollBarStep="20" DataSource='<%=OpenAssetFileDialog.GetModelAnimDs()%>' DefaultNodeHeight="20" style="background:;height:110px;margin-right:10px;">
                <NodeTemplates>
                    <NodeTemplate DataType="anim">
                        <pe:treenode style="height:20px;color:#ffffff" OnClick="OnSelectAnim" can_select="true" text='<%=XPath("this|text") or tostring(XPath("this|id"))%>'></pe:treenode>
                    </NodeTemplate>
                </NodeTemplates>
                <DataNodePlaceholder xpath="*" />
            </pe:treeview>
        </div>
        <div style="float:left;width:450px">
            <div class="mc_paper_panel" style="padding-top:3px;padding-bottom:3px;">
                <pe:treeview ShowIcon="false" uiname="OpenAssetFileDialog.tvwFiles" name="tvwFiles" VerticalScrollBarStep="20" DataSource='<%=OpenAssetFileDialog.GetAllFiles()%>' DefaultNodeHeight="20" style="height:300px;background:;">
                    <NodeTemplates>
                        <NodeTemplate DataType="file">
                            <pe:treenode uiname='<%="OpenAssetFileDialog.sel."..XPath("this|filename")%>'  style="height:20px;" indent="10" OnClick="OnSelectFile" can_select="true" text='<%=string.format("%s (%dKB) %s", commonlib.Encoding.DefaultToUtf8(XPath("this|filename")), math.ceil(XPath("this|filesize")/1000), XPath("this|writedate"))%>'></pe:treenode>
                        </NodeTemplate>
                        <NodeTemplate DataType="commonfile">
                            <pe:treenode style="height:20px;" uiname='<%="OpenAssetFileDialog.sel."..XPath("this|text")%>' indent="10" OnClick="OnSelectFile" can_select="true" text='<%=XPath("this|text")%>'></pe:treenode>
                        </NodeTemplate>
                        <NodeTemplate DataType="category">
                            <pe:treenode style="height:20px;color:#0066c8" expanded='<%=XPath("this|expanded")%>' text='<%=format("%s (%d)", XPath("this|text"), XPath("this|count") or 0)%>'></pe:treenode>
                        </NodeTemplate>
                    </NodeTemplates>
                    <DataNodePlaceholder xpath="*" />
                </pe:treeview>
            </div>
        </div>
    </div>
    <div style="margin-bottom:20px;">
        <div style="color:#ffffff;margin:5px;">
            <%=OpenAssetFileDialog.GetText()%>
        </div>
        <div>
            <input type="text" enable_ime="false" uiname="OpenAssetFileDialog.text" name="text" style="height:24px;width:320px" onchange="OpenAssetFileDialog.OnTextChange"/>
            <input type="button" class="mc_light_grey_button_with_fillet" uiname="OpenAssetFileDialog.openfile" name="openfile" value='...' style="min-width:30px;height:24px;margin-left:3px;" onclick="OpenAssetFileDialog.OnOpenAssetFileDialog"/>
            <input type="button" uiname="OpenAssetFileDialog.OK" name="OK" DefaultButton="true" style="margin-left:20px;min-width:70px;height:24px;" class="mc_light_grey_button_with_fillet" onclick="OpenAssetFileDialog.OnOK" value='<%=L"确定"%>' />
            <input type="button" uiname="OpenAssetFileDialog.Cancel" name="Cancel" DefaultButton="true" style="margin-left:10px;min-width:70px;height:24px;" class="mc_light_grey_button_with_fillet" onclick="OnClose" value='<%=L"取消"%>' />
        </div>
    </div>
</aries:window>
</pe:mcml>
</body>
</html>